import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { Menu } from '../../type';
import { NgFor } from '@angular/common';

@Component({
  selector: 'app-menu',
  imports: [NgFor],
  templateUrl: './menu.component.html',
  styleUrl: './menu.component.scss'
})
export class MenuComponent {
  menus: Array<Menu>;
  currentMenuId: number = 1;
  constructor(private router:Router) {
    this.menus = [
      new Menu(1, '首页', 'dashboard'),
      new Menu(2, '股票管理', '/stock'),
    ];
   }

   ngOnInit() {

  }

  nav(menu:Menu) {
    this.router.navigate([menu.link]);
    this.currentMenuId = menu.id;
  }
}
